// Copyright [2020] <unknown>
#include <bits/stdc++.h>
using namespace std;
#define ONLINE_JUDGE
#ifndef ONLINE_JUDGE
#define dbg(x...) { cerr << "\033[32;1m" << #x << " -> "; err(x); }
void err() { cerr << "\033[39;0m" << endl; }
template<typename T, typename... A>
void err(T a, A... x) { cerr << a << ' '; err(x...); }
#else
#define dbg(...)
#endif

#define sz(x) ((int)x.size())

typedef long long LL;

int t, n, k, m;
const int N = 1e5+50, M = 8;

int l[N], r[N];
pair<int, int> e[N << 1];
bool used[M];
int bit[N];
int dp[1 << M];

inline void update(int &a, int b, int c = 0) {
    if (b == -1) return;
    a = max(a, b + c);
}

bool isGood[1 << M];

int main(int argc, char const *argv[]) {
    scanf("%d%d%d", &n, &m, &k);
    for (int i=0; i<(1<<k); ++i) {
        int j = i;
        int cnt = 0;
        while (j) {
            cnt += j & 1;
            j >>= 1;
        }
        if (cnt & 1)
            isGood[i] = 1;
    }
    // code
    for (int i=1; i<=n; ++i) {
        scanf("%d%d", &l[i], &r[i]);
        e[i*2-2] = make_pair(l[i], i);
        e[i*2-1] = make_pair(r[i]+1, -i);
    }
    sort(e, e+2*n);

    memset(bit, -1, sizeof bit);
    int lim = 1 << k, lastx = 0;
    memset(dp, -1, sizeof dp);
    dp[0] = 0;
    for (int i=0; i < n * 2; ++i) {
        auto &now = e[i];
        int id = abs(now.second), type = now.second;
        int dx = now.first - lastx; lastx = now.first;
        dbg(i, id, dx, type, now.first);


        for (int mask=0; mask < lim; ++mask)
            update(dp[mask], dp[mask], isGood[mask] * dx);
        if (type < 0) {
            int &b = bit[id];
            for (int mask=0; mask<lim; ++mask) {
                update(dp[mask], dp[mask | (1 << b)]);
                dp[mask | (1 << b)] = -1;
            }
            used[b] = false;
            b = -1;
        } else {
            int b = -1;
            for (int j = 0; j < k; ++j)
                if (!used[j]) {
                    used[j] = true;
                    bit[id] = j;
                    b = j;
                    break;
                }
            for (int mask = lim-1; mask >= 0; --mask)
                if ((mask >> b) & 1)
                    update(dp[mask], dp[mask ^ (1 << b)]);
        }
        dbg(i);
        for (int j=0; j<lim; ++j)
            dbg(j, dp[j], isGood[j]);
    }
    int ans = 0;
    for (int i=0; i<lim; ++i)
        update(ans, dp[i]);
    cout << ans << endl;
    return 0;
}
